package com.order.mapper;

import com.order.bean.Admin;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import java.util.List;

public interface AdminMapper {

    @Select("select * from admin where username=#{username}")
    Admin selectByUsername(String username);

    @Insert("insert into admin (username, password, name, avatar, role)" +
            "value (#{username}, #{password}, #{name}, #{avatar}, #{role})")
    boolean insert(Admin admin);

    @Delete("delete from admin where id = #{id}")
    boolean deleteById(Integer id);

    boolean updateById(Admin admin);

    @Select("select * from admin where id = #{id}")
    Admin selectById(Integer id);

    List<Admin> selectAll(String name);

}
